﻿@model IEnumerable<ListProjectModel>

@{
    ViewBag.Title = "Index";
}

@helper GetControls(Neptuo.Forms.Web.Models.ListProjectModel p) {
    @Html.ActionLink((L)"Edit", "edit", new { projectID = p.ProjectID })
    <text> </text>
    @Html.ActionLink((L)"Forms", "forms", new { projectID = p.ProjectID })
    if (p.IsOwner)
    { 
        <text> </text>
        @Html.ActionLink((L)"Invitations", "invitations", new { projectID = p.ProjectID })
    }
}

<div class="folder">
    <h2 class="folder-heading">@Loc("Your projects")</h2>

    @{
        
        UI.Grid(Model)
            .SetEmptyText((L)"No projects")
            .AddColumn((L)"ID", p => p.ProjectID, "w30")
            .AddColumn((L)"Name", p => p.Name)
            .AddColumn((L)"Created", p => p.Created, "w130")
            .AddColumn("", p => GetControls(p), "w140")
            .Render();
    }

    <div class="folder-foot">
        @Html.ActionLink((L)"+Create", "create")
    </div>
</div>
